#include <cstdio>
using namespace std;
const int N = 5005, P = 5005; 
int n, m, p;
int x[N], y[N];
int a[P], b[P];
int S[N];
int getf (int d) {
	if (d == S[d]) {
		return d;
	} else {
		return S[d] = getf(S[d]);
	}
}
void merge (int d, int e) {
	if (getf(d) != getf(e)) {
		S[S[d]] = S[e];
		S[d] = S[e];
	}
}
int main () {
	scanf ("%d%d%d", &n, &m, &p);
	for (int i = 1; i <= n; i++) {
		S[i] = i;
	}
	for (int i = 1; i <= m; i++) {
		scanf ("%d%d", &a[i], &b[i]);
		merge (a[i], b[i]);
	}
	for (int i = 1; i <= p; i++) {
		scanf ("%d%d", &x[i], &y[i]);
		if (getf(x[i]) == getf(y[i])) {
			printf ("Yes\n");
		} else {
			printf ("No\n");
		}
	}
	return 0;
}